﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Crystal.CLL;
using CrystalClientManagment.View;
using CrystalCommon.ControlLib;
using System.Configuration;
namespace CrystalAdmin.View
{
    public partial class Home : BaseForm
    {
        public Home()
        {
            InitializeComponent();
        }

        //protected override void OnLoad(EventArgs e)
        //{
        //    //Login log = new Login();
            
        //    //btnExit.BackColor = System.Drawing.Color.FromArgb(166, 166, 166);
        //    //this.BackColor = System.Drawing.Color.Black;
        //    SetControlProperties();
        //}

        private void SetControlProperties()
        {
            this.Text = TitleManager.GetTitle("Administration");
        }

        private void btnListUsers_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnUserManagement_Click(object sender, EventArgs e)
        {
            ListUsers frmListUsers = new ListUsers();
            if (CommonCLL.FocusOnExistingInstanceByName(frmListUsers.Name))
            {
                frmListUsers.Show();
            }
            else
                frmListUsers.BringToFront();
        }

        private void btnClientManagement_Click(object sender, EventArgs e)
        {
            frmClientManagement frmClient = new frmClientManagement();
            if (CommonCLL.FocusOnExistingInstanceByName(frmClient.Name))
            {
                frmClient.Show();
            }
        }

        private void btnProjectManagement_Click(object sender, EventArgs e)
        {
            frmProjectManagement frmProject = new frmProjectManagement();
            if (CommonCLL.FocusOnExistingInstanceByName(frmProject.Name))
            {
                frmProject.Show();
            }
        }

        private void Home_Load(object sender, EventArgs e)
        {
            CrystalCommon.View.Login login = new CrystalCommon.View.Login();
            login.ShowDialog();
            if (CommonCLL.UserID == 0)
            {
                this.Close();
            }
            SetControlProperties();
            //BLLmdlCommon.UserId = CommonCLL.UserID;
            //BLLmdlCommon.UserName = CommonCLL.UserName;
            //CommonCLL.mstrConnectionstring = ConfigurationManager.ConnectionStrings["LoggingConnectionString"].ConnectionString;
            login = null;
        }

        

    }
}
